﻿@model HousePicDTO[]
@{
    ViewBag.Title = "房源图片列表";
}
<link href="~/Areas/WebAdmin/FrontLib/lightbox2/2.8.1/css/lightbox.css" rel="stylesheet" type="text/css">

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 房源管理 <span class="c-gray en">&gt;</span> 房源图片展示 <a class="btn btn-success radius r btn-refresh" style="line-height:1.6em;margin-top:3px" href="javascript:;" onclick="javascript: location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">  <a href="javascript:;" onclick="batch_del()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> </span> <span class="r">共有数据：<strong>@Model.Count()</strong> 条</span> </div>
    <div class="portfolio-content">
        <form id="formList">
            <ul class="cl portfolio-area">
                @{
                    long indexPic = 1;
                    foreach (var pic in Model)
                    {
                        <li class="item">
                            <div class="portfoliobox">
                                <input class="checkbox" name="selectedIds" type="checkbox" value="@pic.Id">
                                <div class="picbox"><a href="@pic.Url" data-lightbox="gallery" data-title="房源图片 @indexPic"><img src="@pic.ThumbUrl"></a></div>
                                <div class="textbox">房源图片 @indexPic</div>
                            </div>
                        </li>
                        indexPic++;
                    }
                }
            </ul>
        </form>
    </div>
</div>

@section FooterScript
{
    <script type="text/javascript" src="~/Areas/WebAdmin/FrontLib/lightbox2/2.8.1/js/lightbox.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".portfolio-area li").Huihover();
        });

        //批量删除
        function batch_del() {
            layer.confirm("确认要批量删除吗？", function () {
                var formData = $("#formList").serializeArray();
                $.ajax({
                    url: "/WebAdmin/House/DeletePics",
                    type: "post",
                    data: formData,
                    dataType: "json",
                    success: function (res) {
                        if (res.status == "ok") {
                            layer.msg('已批量删除!', { icon: 1, time: 2000 }, function () {
                                $(".btn-refresh").click();
                            });
                        } else if (res.status == "redirect") {
                            location.href = res.data;
                        } else if (res.status == "error") {
                            layer.msg(res.errorMsg, { icon: 2, time: 1000 });
                        } else {
                            layer.msg("批量删除失败", { icon: 2, time: 1000 });
                        }
                    },
                    error: function () {
                        layer.msg('网络出错!', { icon: 2, time: 2000 });
                    }
                });
            });
        }
    </script>
}

